package com.kxmall.web.controller.huishouapp;

import cn.dev33.satoken.annotation.SaIgnore;
import com.kxmall.common.core.controller.BaseAppController;
import com.kxmall.common.core.domain.PageQuery;
import com.kxmall.common.core.domain.R;
import com.kxmall.common.core.page.TableDataInfo;
import com.kxmall.coupon.domain.vo.KxStoreCouponUserVo;
import com.kxmall.coupon.mapper.KxStoreCouponUserMapper;
import com.kxmall.huishou.domain.bo.HsWasteActivityBo;
import com.kxmall.huishou.domain.vo.HsWasteActivityVo;
import com.kxmall.huishou.domain.vo.HsWasteSiteVo;
import com.kxmall.huishou.service.IHsWasteSiteService;
import com.kxmall.web.controller.coupon.service.IKxAppCouponService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * 我的会员管理
 *
 * @author lf
 * @date 2023-12-01
 */

@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/vip/app")
public class HsAppVipController extends BaseAppController {

    private final IHsWasteSiteService iHsWasteSiteService;
    private final IKxAppCouponService iKxAppCouponService;

    /**
     * 查询兑换记录列表优惠券状态[1未使用2已使用3已过期]
     */
    @SaIgnore
    @GetMapping("record/selectUserExchangeRecord")
    public R<List<KxStoreCouponUserVo>> getUserCoupons(Integer status) {
        Long userId = getAppLoginUser().getUserId();
        return R.ok(iKxAppCouponService.getUserCouponss(userId,status));
    }


    /**
     * 获取兑换记录列表优惠券详细信息
     *
     * @param id 主键
     */
    @SaIgnore
    @GetMapping("/{id}")
    public R<KxStoreCouponUserVo> getInfo(@NotNull(message = "主键不能为空")@PathVariable Long id) {
        return R.ok(iKxAppCouponService.getUserCouponsById(id));
    }










}
